<template>
	<view class="forum_post_cell_content app_content_color" @tap="cellTap">
		<image class="forum_post_cell_avatar app_background_color" mode="aspectFill" :src="item.userAvatar" v-if="item.userAvatar" @tap="avatarTap"></image>
		<image class="forum_post_cell_avatar app_background_color" mode="aspectFill" :src="'http://bbs.uestc.edu.cn/uc_server/avatar.php?uid='+item.user_id+'&size=middle'"  @tap="avatarTap" v-else></image>
		
		<view class="forum_post_cell_info_content">
			<view class="forum_post_cell_info_title app_title_color">{{item.title}}</view>
			<view class="forum_post_cell_info_summary app_subtitle_color" v-if="item.summary">{{item.summary}}</view>
			<view class="forum_post_cell_info_summary app_subtitle_color" v-else>{{item.subject}}</view>
			<view class="forum_post_cell_info_board_content">
				<view class="forum_post_cell_info_board_cell_content">
					<view>{{item.user_nick_name}}</view>
				</view>
				<view class="forum_post_cell_info_board_cell_content" v-if="item.board_name">
					<view>{{item.board_name}}</view>
				</view>
			</view>
			<view class="forum_post_cell_info_board_content">
				<view class="forum_post_cell_info_time_text app_title_color">{{item.showTime}}</view>
				<view class="forum_post_cell_info_time_text app_title_color">{{'回复:'+item.replies}}</view>
				<view class="forum_post_cell_info_time_text app_title_color">{{'阅读:'+item.hits}}</view>
			</view>

		</view>
	</view>
</template>
<script>
	export default {
		props: {
			item: {}
		},
		methods:{
			cellTap(){
				if(getApp().globalData.user == null){
					uni.navigateTo({
						url:"/pages/login/login"
					})
					return
				}
				var topicId = this.item.source_id;
				if(!topicId){
					topicId = this.item.topic_id;
				}
				uni.navigateTo({
					url:"/pages/forum-post-detail/forum-post-detail?topicId="+topicId
				})
			},
			avatarTap(){
				if(getApp().globalData.user == null){
					uni.navigateTo({
						url:"/pages/login/login"
					})
					return
				}
				uni.navigateTo({
					url:"/pages/other-user/other-user?uid="+this.item.user_id
				})
			}
		}
	}
</script>

<style lang="scss">
	.forum_post_cell_content{
		display: flex;
		margin-top: 1upx;
		width: 100%;
		flex-direction: row;
	}

	.forum_post_cell_avatar {
		width: 80upx;
		height: 80upx;
		min-width: 80upx;
		max-width: 80upx;
		border-radius: 40upx;
		margin-top: 30upx;
		margin-left: 30upx;
	}

	.forum_post_cell_info_content {
		display: flex;
		margin-left: 20upx;
		flex-direction: column;
		flex-grow: 1;
		margin-top: 30upx;
		margin-bottom: 30upx;
		margin-right: 30upx;
	}

	.forum_post_cell_info_title{
		font-size: 30upx;
		word-wrap:break-word;
		max-width: 600upx;
	}

	.forum_post_cell_info_summary {
		color: #aaaaaa;
		font-size: 25upx;
		margin-top: 10upx;
	}

	.forum_post_cell_info_board_content {
		display: flex;
		flex-direction: row;
		margin-top: 20upx;
	}

	.forum_post_cell_info_board_cell_content {
		display: flex;
		background-color: $uni-global-green-color;
		border-radius: 4upx;
		height: 30upx;
		padding-left: 10upx;
		padding-right: 10upx;
		align-items: center;
		justify-content: center;
		color: #fff;
		font-size: 20upx;
		margin-right: 10upx;
	}

	.forum_post_cell_info_time_text {
		font-size: 20upx;
		margin-right: 40upx;
	}
</style>
